﻿using Bmz.Studio.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bmz.Studio.Services
{
    public class DictionaryService:IDictionaryService
    {
        IRepository<Dictionary> _repository;

        public DictionaryService(IRepository<Dictionary> repository)
        {
            _repository = repository;
        }

        public string GetNameByCode(string code)
        {
            return _repository.Table.FirstOrDefault(p=>p.Code==code).Name;
        }

        public List<Dictionary> GetListByType(string type)
        {
            return _repository.Table.Where(p => p.Type == type).ToList();
        }

    }
}
